home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Ham⁄GPS / SoftKiss.src.1.8 Folder / SoftKiss.src.1.8.sit / SoftKiss.src.1.8 / lib / sfk_drvr_install.c < prev    next >
Text File  |  1992-06-28  |  2KB  |  68 lines

  1. /*
  2.  * install softkiss driver
  3.  * by Aaron Wohl / N3LIW (aw0g+@andrew.cmu.edu) jul 1990
  4.  * 6393 Penn Ave #303
  5.  * Pittsburgh PA, 15206
  6.  * work: (412)-268-5032
  7.  * home: (412)-731-6159
  8.  */
  9.  
  10. #include "sfk_core.h"
  11. #include "sfk_core_private.h"
  12. #include "driver_shell.h"
  13. #include "sfk_drvr_find.h"
  14. #include "sfk_os_preserve.h"
  15.  
  16. /*
  17.  * find the softkiss driver
  18.  * if it is not present, install it
  19.  */
  20. static short sfk_drvr_find_or_installi(short *refnum)
  21. {
  22.     short new_refnum;
  23.     Handle shell_template=0;
  24.     Handle sfk_header=0;
  25.     Handle sfk_body=0;
  26.     unsigned char *sfk_body_ptr;
  27.     driver_shell_header_pt ash;
  28.     if(((*refnum)=sfk_drvr_find(sfk_driver_name,&new_refnum))!=0)
  29.         return 0;
  30.     if((shell_template=sh_read_in_driver_shell())==0)
  31.         goto error_exit;
  32.     if((sfk_header=sh_copy_template(shell_template))==0)
  33.         goto error_exit;
  34.     ash= sh_strip_address(*sfk_header);
  35.     if((sfk_body=sh_read_in_sys_res('PROC',sfk_driver_resource))==0)
  36.         goto error_exit;
  37.     sfk_body_ptr=sh_strip_address(*sfk_body);
  38.     if(!sh_prepare(ash,sfk_driver_name,
  39.             dNeedLock|dCtlEnable|dRAMBased|dNeedTime,
  40.             2,
  41.             (long)sfk_body_ptr,
  42.             (long)sfk_body_ptr,
  43.             (long)sfk_body_ptr,
  44.             (long)shell_template))
  45.                 goto error_exit;
  46.     if(Real_DrvrInstall(sfk_header,new_refnum)) 
  47.         goto error_exit;
  48.     return new_refnum;
  49.  
  50. error_exit:
  51.     if(sfk_body!=0)
  52.         DisposeHandle(sfk_body);
  53.     if(sfk_header!=0)
  54.         DisposeHandle(sfk_header);
  55.     if(shell_template!=0)
  56.         DisposeHandle(shell_template);
  57.     return 0;
  58. }
  59.  
  60. /*
  61.  * find the softkiss driver
  62.  * if it is not present, install it
  63.  */
  64. short sfk_drvr_find_or_install(short *refnum)
  65. {
  66.     return OSP_protected_call(OSP_sys,sfk_drvr_find_or_installi,refnum,0,0,0);
  67. }
  68.